# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfig do
  @moduledoc """
  An API Configuration is a combination of settings for both the Managed Service and Gateways serving this API Config.

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Created time.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Optional. Display name.
  *   `gatewayConfig` (*type:* `GoogleApi.APIGateway.V1beta.Model.ApigatewayGatewayConfig.t`, *default:* `nil`) - Immutable. Gateway specific configuration.
  *   `gatewayServiceAccount` (*type:* `String.t`, *default:* `nil`) - Immutable. The Google Cloud IAM Service Account that Gateways serving this config should use to authenticate to other services. This may either be the Service Account's email (`{ACCOUNT_ID}@{PROJECT}.iam.gserviceaccount.com`) or its full resource name (`projects/{PROJECT}/accounts/{UNIQUE_ID}`). This is most often used when the service is a GCP resource such as a Cloud Run Service or an IAP-secured service.
  *   `grpcServices` (*type:* `list(GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfigGrpcServiceDefinition.t)`, *default:* `nil`) - Optional. gRPC service definition files. If specified, openapi_documents must not be included.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Optional. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
  *   `managedServiceConfigs` (*type:* `list(GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfigFile.t)`, *default:* `nil`) - Optional. Service Configuration files. At least one must be included when using gRPC service definitions. See https://cloud.google.com/endpoints/docs/grpc/grpc-service-config#service_configuration_overview for the expected file contents. If multiple files are specified, the files are merged with the following rules: * All singular scalar fields are merged using "last one wins" semantics in the order of the files uploaded. * Repeated fields are concatenated. * Singular embedded messages are merged using these rules for nested fields.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Resource name of the API Config. Format: projects/{project}/locations/global/apis/{api}/configs/{api_config}
  *   `openapiDocuments` (*type:* `list(GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfigOpenApiDocument.t)`, *default:* `nil`) - Optional. OpenAPI specification documents. If specified, grpc_services and managed_service_configs must not be included.
  *   `serviceConfigId` (*type:* `String.t`, *default:* `nil`) - Output only. The ID of the associated Service Config ( https://cloud.google.com/service-infrastructure/docs/glossary#config).
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. State of the API Config.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Updated time.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t() | nil,
          :displayName => String.t() | nil,
          :gatewayConfig => GoogleApi.APIGateway.V1beta.Model.ApigatewayGatewayConfig.t() | nil,
          :gatewayServiceAccount => String.t() | nil,
          :grpcServices =>
            list(GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfigGrpcServiceDefinition.t())
            | nil,
          :labels => map() | nil,
          :managedServiceConfigs =>
            list(GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfigFile.t()) | nil,
          :name => String.t() | nil,
          :openapiDocuments =>
            list(GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfigOpenApiDocument.t()) | nil,
          :serviceConfigId => String.t() | nil,
          :state => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:createTime, as: DateTime)
  field(:displayName)
  field(:gatewayConfig, as: GoogleApi.APIGateway.V1beta.Model.ApigatewayGatewayConfig)
  field(:gatewayServiceAccount)

  field(:grpcServices,
    as: GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfigGrpcServiceDefinition,
    type: :list
  )

  field(:labels, type: :map)

  field(:managedServiceConfigs,
    as: GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfigFile,
    type: :list
  )

  field(:name)

  field(:openapiDocuments,
    as: GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfigOpenApiDocument,
    type: :list
  )

  field(:serviceConfigId)
  field(:state)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfig do
  def decode(value, options) do
    GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.APIGateway.V1beta.Model.ApigatewayApiConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
